﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <LinearGradientBrush x:Key="UserControlBackgroundBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Offset="0" Color="#BFC3C8"/>
        <GradientStop Offset="1" Color="#91959A"/>
    </LinearGradientBrush>

    <Style TargetType="{x:Type Separator}">
        <Setter Property="Height" Value="2" />
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Focusable" Value="false" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Separator}">
                    <StackPanel>
                        <Border Height="1" Background="#602E3740" />
                        <Border Height="1" Background="#80FFFFFF" />
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="TextWindowDesignElement" TargetType="Control">
        <Grid SnapsToDevicePixels="True">
            <Border Name="Border" Background="#FFFFFF" BorderBrush="#FF8E9397" BorderThickness="0,1,0,0"/>
            <Border Height="3" Margin="0,1,0,0" VerticalAlignment="Top">
                <Border.Background>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                        <GradientStop Offset="0" Color="#3000"/>
                        <GradientStop Offset="1" Color="#0000"/>
                    </LinearGradientBrush>
                </Border.Background>
            </Border>
            <Border Width="3" HorizontalAlignment="Left" Margin="0,1,0,0">
                <Border.Background>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                        <GradientStop Offset="0" Color="#2000"/>
                        <GradientStop Offset="1" Color="#0000"/>
                    </LinearGradientBrush>
                </Border.Background>
            </Border>
            <Border Width="3" HorizontalAlignment="Right" Margin="0,1,0,0">
                <Border.Background>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                        <GradientStop Offset="0" Color="#0000"/>
                        <GradientStop Offset="1" Color="#2000"/>
                    </LinearGradientBrush>
                </Border.Background>
            </Border>
        </Grid>
    </ControlTemplate>

    <!-- CheckBox -->

    <Style x:Key="{x:Type CheckBox}" TargetType="{x:Type CheckBox}">
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Foreground" Value="#2E3740" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type CheckBox}">
                    <BulletDecorator Background="Transparent">
                        <BulletDecorator.Bullet>
                            <Grid Width="12" Height="12">
                                <Control Template="{StaticResource TextWindowDesignElement}"/>
                                <Path
                      x:Name="CheckMark"
                      Width="7"
                      Height="7"
                      Data="M 0 0 L 7 7 M 0 7 L 7 0"
                      SnapsToDevicePixels="False"
                      Stroke="#404040"
                      StrokeThickness="2"/>
                            </Grid>
                        </BulletDecorator.Bullet>
                        <ContentPresenter HorizontalAlignment="Left" Margin="4,0,0,0" VerticalAlignment="Center" RecognizesAccessKey="True"/>
                    </BulletDecorator>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="false">
                            <Setter TargetName="CheckMark" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="IsChecked" Value="{x:Null}">
                            <Setter TargetName="CheckMark" Property="Data" Value="M 0 7 L 7 0"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="{x:Type ButtonBase}">
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Padding" Value="20,0"/>
        <Setter Property="MinHeight" Value="20"/>
        <Setter Property="MinWidth" Value="24"/>
        <Setter Property="FontWeight" Value="Bold"/>
        <Setter Property="Foreground" Value="#3A3A3A"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                    <GradientStop Offset="0" Color="#E8E8E8"/>
                    <GradientStop Offset="1" Color="#9A9A9A"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ButtonBase}">
                    <Grid>
                        <Border x:Name="ShadowBorder" Margin="1" Background="#E6E6E6" CornerRadius="2">
                            <Border.Effect>
                                <DropShadowEffect Direction="-90" Opacity="0.5" ShadowDepth="0"/>
                            </Border.Effect>
                        </Border>
                        <Border x:Name="Border" Background="{TemplateBinding Background}" BorderThickness="0,1,0,1" CornerRadius="1">
                            <Border.BorderBrush>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <GradientStop Offset="0" Color="White"/>
                                    <GradientStop Offset="1" Color="#606060"/>
                                </LinearGradientBrush>
                            </Border.BorderBrush>
                            <ContentPresenter
                    x:Name="ContentHost"
                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                    Margin="{TemplateBinding Padding}"
                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                    RecognizesAccessKey="True"/>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsKeyboardFocused" Value="true">
                            <Setter Property="Background">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                        <GradientStop Offset="0" Color="#FFFFFF"/>
                                        <GradientStop Offset="1" Color="#BABABA"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                        <GradientStop Offset="0" Color="#E8E8E8"/>
                                        <GradientStop Offset="1" Color="#B0B0B0"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter Property="Background">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                        <GradientStop Offset="0" Color="#D1D1D1"/>
                                        <GradientStop Offset="1" Color="#9E9E9E"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="ShadowBorder" Property="Effect">
                                <Setter.Value>
                                    <DropShadowEffect Direction="-90" ShadowDepth="0"/>
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="ContentHost" Property="RenderTransform">
                                <Setter.Value>
                                    <TranslateTransform Y="0"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Background" Value="#EEEEEE"/>
                            <Setter TargetName="Border" Property="BorderBrush" Value="#AAAAAA"/>
                            <Setter Property="Foreground" Value="#888888"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style BasedOn="{StaticResource {x:Type ButtonBase}}" TargetType="{x:Type Button}">
        <Style.Triggers>
            <Trigger Property="IsDefaulted" Value="true">
                <Setter Property="Background">
                    <Setter.Value>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                            <GradientStop Offset="0" Color="#FFFFFF"/>
                            <GradientStop Offset="1" Color="#BABABA"/>
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style BasedOn="{StaticResource {x:Type ButtonBase}}" TargetType="{x:Type ToggleButton}"/>
    
    <Style x:Key="GroupH1" TargetType="HeaderedContentControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="HeaderedContentControl">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <!-- 
                              Using a TextBlock for the header instead of a ContentPresenter
                              because we want two copies of the content in order to make a 
                              beveled effect.  That's fine with strings but creates problems
                              if the content is a UI element.  Using a TextBlock prevents 
                              that error from every showing up.
                            -->
                        <TextBlock
                              Margin="0,1,0,-1"
                              FontFamily="Segoe UI"
                              FontSize="16"
                              Foreground="#80FFFFFF"
                              Text="{TemplateBinding Header}"/>
                        <TextBlock FontFamily="Segoe UI" FontSize="16" Foreground="#FF2E3740" Text="{TemplateBinding Header}"/>
                        <ContentPresenter Grid.Row="1"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>




    <!-- ComboBox -->

    <Style x:Key="InvisibleToggleButton" TargetType="{x:Type ToggleButton}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Grid>
                        <Border x:Name="Border" Background="Transparent"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="EditableComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Grid>
                        <Border x:Name="Border" Background="Transparent"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="{x:Type ComboBox}" TargetType="{x:Type ComboBox}">
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
        <Setter Property="MinWidth" Value="30"/>
        <Setter Property="IsEditable" Value="True"/>
        <Setter Property="VerticalAlignment" Value="Top"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ComboBox}">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <TextBlock
                  Margin="0,1,0,2"
                  FontFamily="Segoe UI"
                  FontSize="11"
                  Foreground="#40FFFFFF"
                  Text="{TemplateBinding Tag}"/>
                        <TextBlock
                  Margin="0,0,0,3"
                  FontFamily="Segoe UI"
                  FontSize="11"
                  Foreground="#2E3740"
                  Text="{TemplateBinding Tag}"/>
                        <ToggleButton
                  Name="ToggleButton"
                  Grid.Row="1"
                  ClickMode="Press"
                  Focusable="false"
                  IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"/>
                        <ContentPresenter
                  Name="ContentSite"
                  Grid.Row="1"
                  HorizontalAlignment="Left"
                  Margin="8,-1,23,1"
                  VerticalAlignment="Center"
                  Content="{TemplateBinding SelectionBoxItem}"
                  ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                  ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                  IsHitTestVisible="False"/>
                        <TextBox
                  x:Name="PART_EditableTextBox"
                  Grid.Row="1"
                  Margin="0,-1,0,0"
                  Background="White"
                  Focusable="True"
                  IsReadOnly="{TemplateBinding IsReadOnly}"
                  TextWrapping="Wrap"
                  Visibility="Collapsed"/>
                        <ToggleButton
                  Width="25"
                  Grid.Row="1"
                  HorizontalAlignment="Right"
                  ClickMode="Press"
                  Focusable="false"
                  IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"
                  Style="{StaticResource EditableComboBoxToggleButton}">
                        </ToggleButton>
                        <Path
                  x:Name="Arrow"
                  Width="7"
                  Height="4"
                  Grid.Column="1"
                  Grid.Row="1"
                  HorizontalAlignment="Right"
                  Margin="0,0,5,0"
                  VerticalAlignment="Center"
                  Data="M 0 0 L 4 4 L 8 0 Z"
                  Fill="#404040"
                  IsHitTestVisible="False"
                  Stretch="Fill"/>
                        <Popup
                  Name="Popup"
                  AllowsTransparency="True"
                  Focusable="False"
                  IsOpen="{TemplateBinding IsDropDownOpen}"
                  Placement="Bottom"
                  PopupAnimation="Slide">
                            <Grid
                    Name="DropDown"
                    MaxHeight="{TemplateBinding MaxDropDownHeight}"
                    MinWidth="{TemplateBinding ActualWidth}"
                    Margin="6,0,6,6"
                    SnapsToDevicePixels="True">
                                <Border
                      x:Name="DropDownBorder"
                      Margin="0,1,0,0"
                      Background="#FFFFFF"
                      BorderThickness="0,1"
                      CornerRadius="2">
                                    <Border.Effect>
                                        <DropShadowEffect BlurRadius="6" Direction="-90" Opacity="0.4" ShadowDepth="2"/>
                                    </Border.Effect>
                                </Border>
                                <ScrollViewer Margin="0,4" SnapsToDevicePixels="True">
                                    <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained"/>
                                </ScrollViewer>
                            </Grid>
                        </Popup>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="HasItems" Value="false">
                            <Setter TargetName="DropDownBorder" Property="MinHeight" Value="95"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="#888888"/>
                        </Trigger>
                        <Trigger Property="IsGrouping" Value="true">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                        </Trigger>
                        <Trigger Property="IsEditable" Value="true">
                            <Setter Property="IsTabStop" Value="false"/>
                            <Setter TargetName="ToggleButton" Property="Style" Value="{StaticResource InvisibleToggleButton}"/>
                            <Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="ContentSite" Property="Visibility" Value="Hidden"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
        </Style.Triggers>
    </Style>

    <!-- ComboBoxItem -->

    <Style x:Key="{x:Type ComboBoxItem}" TargetType="{x:Type ComboBoxItem}">
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ComboBoxItem}">
                    <Border Name="Border" Background="Transparent" BorderBrush="Transparent">
                        <ContentPresenter Margin="8,2"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsHighlighted" Value="true">
                            <Setter TargetName="Border" Property="Background" Value="#3E4955"/>
                            <Setter Property="Foreground" Value="#FFFFFF"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="#888888"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="NotesEntryGroup" TargetType="HeaderedContentControl">
        <Setter Property="Margin" Value="0,8,0,8" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="HeaderedContentControl">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <ContentPresenter TextElement.FontFamily="Segoe UI" TextElement.FontSize="10" TextElement.FontWeight="Bold" TextElement.Foreground="#3372BB" Content="{TemplateBinding Header}"/>
                        <ContentPresenter Grid.Row="1"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>